// components/package_list/list.js
Component({
  /**
   * 组件的属性列表
   */
  properties: {
    hsbzqd_list: {
      type: Array,
      value: []
    },
    pack_index: {
      type: Number,
      value: 1
    },
    pack_total: {
      type: Number,
      value: 0
    },
    pack_list_1: {
      type: Array,
      value: []
    },
    photo_list: {
      type: Array,
      value: []
    },



  },

  /**
   * 组件的初始数据
   */
  data: {

  },

  /**
   * 组件的方法列表
   */
  methods: {
    remarksShow(e) {
      let msg = e.currentTarget.dataset.row_data
      wx.showModal({
        title: '详情',
        content: msg,
        success: function (res) {
          if (res.confirm) { //这里是点击了确定以后
            // console.log('用户点击确定')
          } else { //这里是点击了取消以后
            // console.log('用户点击取消')
          }
        }
      })

    },
    pageUp() {
      let now_index = this.data.pack_index
      if (now_index != 1) {
        now_index = now_index - 1
        let spjl_l = this.data.hsbzqd_list

        let show_list = []
        show_list.push(spjl_l[now_index - 1])
        this.setData({
          pack_index: now_index,
          pack_list_1: show_list,
        })
      }
    },
    pageDown() {
      let now_index = this.data.pack_index
      if (now_index < this.data.pack_total) {
        now_index = now_index + 1
        let spjl_l = this.data.hsbzqd_list
        let show_list = []
        show_list.push(spjl_l[now_index - 1])
        this.setData({
          pack_list_1: show_list,
          pack_index: now_index
        })

      }
    },
    // 预览照片
    previewPhoto(e) {
      let img_url = e.currentTarget.dataset.row_data
      let a = img_url.split('=')[1]
      let p_list = this.data.photo_list
      let u = []
      let us = []
      for (let i in p_list) {
        for (let j in p_list[i]) {
          if (p_list[i][j] == a) {
            u = p_list[i]
            for (let k in u) {
              us.push("https://logisticsengineering.gree.com/package_integrated_api/photo_manage/" + "fs_download?file_id=" + u[k])
            }
          }
        }
      }
      wx.previewImage({
        current: img_url,
        urls: us,
      })
    },
  }
})
